package com.aba.cms.teacher;

import java.util.List;
import java.util.Scanner;

public class TeacherView {
    private Scanner scanner = new Scanner(System.in);

    // 显示教师管理菜单
    public int showMenu() {
        System.out.println("\n===== 教师管理系统 =====");
        System.out.println("1. 添加教师");
        System.out.println("2. 编辑教师信息");
        System.out.println("3. 查询教师");
        System.out.println("4. 查看所有教师");
        System.out.println("5. 退出");
        System.out.print("请选择操作: ");
        return scanner.nextInt();
    }

    // 获取教师输入信息
    public Teacher getTeacherInput() {
        scanner.nextLine(); // 消耗换行符
        Teacher teacher = new Teacher();
        
        System.out.print("请输入教师姓名: ");
        teacher.setName(scanner.nextLine());
        
        System.out.print("请输入教师院系: ");
        teacher.setDepartment(scanner.nextLine());
        
        System.out.print("请输入教师职称: ");
        teacher.setTitle(scanner.nextLine());
        
        System.out.print("请输入教师电话: ");
        teacher.setPhone(scanner.nextLine());
        
        System.out.print("请输入教师邮箱: ");
        teacher.setEmail(scanner.nextLine());
        
        return teacher;
    }

    // 显示教师信息
    public void displayTeacher(Teacher teacher) {
        System.out.println("\n===== 教师信息 =====");
        System.out.println(teacher);
        
        if (teacher.getCourses() != null && !teacher.getCourses().isEmpty()) {
            System.out.println("\n===== 所授课程 =====");
            for (Course course : teacher.getCourses()) {
                System.out.println(course);
            }
        } else {
            System.out.println("\n该教师暂无授课安排");
        }
    }

    // 显示教师列表
    public void displayTeachers(List<Teacher> teachers) {
        System.out.println("\n===== 教师列表 =====");
        for (Teacher teacher : teachers) {
            System.out.println(teacher);
            System.out.println("-------------------");
        }
    }

    // 获取教师ID
    public int getTeacherId() {
        System.out.print("请输入教师ID: ");
        return scanner.nextInt();
    }

    // 获取搜索关键词
    public String getSearchKeyword() {
        scanner.nextLine(); // 消耗换行符
        System.out.print("请输入搜索关键词: ");
        return scanner.nextLine();
    }

    // 显示消息
    public void showMessage(String message) {
        System.out.println(message);
    }
}    